\(\int \csc (c+d x) (a+b \sin ^2(c+d x)) \, dx\) [66]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 26 \[ \int \csc (c+d x) \left (a+b \sin ^2(c+d x)\right ) \, dx=-\frac {a \text {arctanh}(\cos (c+d x))}{d}-\frac {b \cos (c+d x)}{d} \]

[Out]

-a*arctanh(cos(d*x+c))/d-b*cos(d*x+c)/d

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.105, Rules used = {3093, 3855} \[ \int \csc (c+d x) \left (a+b \sin ^2(c+d x)\right ) \, dx=-\frac {a \text {arctanh}(\cos (c+d x))}{d}-\frac {b \cos (c+d x)}{d} \]

[In]

Int[Csc[c + d*x]*(a + b*Sin[c + d*x]^2),x]

[Out]

-((a*ArcTanh[Cos[c + d*x]])/d) - (b*Cos[c + d*x])/d

Rule 3093

Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Cos
[e + f*x]*((b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Dist[(A*(m + 2) + C*(m + 1))/(m + 2), Int[(b*Sin[e +
f*x])^m, x], x] /; FreeQ[{b, e, f, A, C, m}, x] &&  !LtQ[m, -1]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = -\frac {b \cos (c+d x)}{d}+a \int \csc (c+d x) \, dx \\ & = -\frac {a \text {arctanh}(\cos (c+d x))}{d}-\frac {b \cos (c+d x)}{d} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(63\) vs. \(2(26)=52\).

Time = 0.05 (sec) , antiderivative size = 63, normalized size of antiderivative = 2.42 \[ \int \csc (c+d x) \left (a+b \sin ^2(c+d x)\right ) \, dx=-\frac {b \cos (c) \cos (d x)}{d}-\frac {a \log \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )\right )}{d}+\frac {a \log \left (\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right )}{d}+\frac {b \sin (c) \sin (d x)}{d} \]

[In]

Integrate[Csc[c + d*x]*(a + b*Sin[c + d*x]^2),x]

[Out]

-((b*Cos[c]*Cos[d*x])/d) - (a*Log[Cos[c/2 + (d*x)/2]])/d + (a*Log[Sin[c/2 + (d*x)/2]])/d + (b*Sin[c]*Sin[d*x])
/d

Maple [A] (verified)

Time = 0.52 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.08

method result size
parallelrisch \(\frac {-\cos \left (d x +c \right ) b +a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )+b}{d}\) \(28\)
derivativedivides \(\frac {a \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )-\cos \left (d x +c \right ) b}{d}\) \(33\)
default \(\frac {a \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )-\cos \left (d x +c \right ) b}{d}\) \(33\)
risch \(-\frac {b \,{\mathrm e}^{i \left (d x +c \right )}}{2 d}-\frac {b \,{\mathrm e}^{-i \left (d x +c \right )}}{2 d}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}\) \(67\)
norman \(\frac {\frac {2 b \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {2 b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+\frac {a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}\) \(68\)

[In]

int(csc(d*x+c)*(a+b*sin(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(-cos(d*x+c)*b+a*ln(tan(1/2*d*x+1/2*c))+b)

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 42, normalized size of antiderivative = 1.62 \[ \int \csc (c+d x) \left (a+b \sin ^2(c+d x)\right ) \, dx=-\frac {2 \, b \cos \left (d x + c\right ) + a \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - a \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{2 \, d} \]

[In]

integrate(csc(d*x+c)*(a+b*sin(d*x+c)^2),x, algorithm="fricas")

[Out]

-1/2*(2*b*cos(d*x + c) + a*log(1/2*cos(d*x + c) + 1/2) - a*log(-1/2*cos(d*x + c) + 1/2))/d

Sympy [F]

\[ \int \csc (c+d x) \left (a+b \sin ^2(c+d x)\right ) \, dx=\int \left (a + b \sin ^{2}{\left (c + d x \right )}\right ) \csc {\left (c + d x \right )}\, dx \]

[In]

integrate(csc(d*x+c)*(a+b*sin(d*x+c)**2),x)

[Out]

Integral((a + b*sin(c + d*x)**2)*csc(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.46 \[ \int \csc (c+d x) \left (a+b \sin ^2(c+d x)\right ) \, dx=-\frac {2 \, b \cos \left (d x + c\right ) + a \log \left (\cos \left (d x + c\right ) + 1\right ) - a \log \left (\cos \left (d x + c\right ) - 1\right )}{2 \, d} \]

[In]

integrate(csc(d*x+c)*(a+b*sin(d*x+c)^2),x, algorithm="maxima")

[Out]

-1/2*(2*b*cos(d*x + c) + a*log(cos(d*x + c) + 1) - a*log(cos(d*x + c) - 1))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 58 vs. \(2 (26) = 52\).

Time = 0.29 (sec) , antiderivative size = 58, normalized size of antiderivative = 2.23 \[ \int \csc (c+d x) \left (a+b \sin ^2(c+d x)\right ) \, dx=\frac {a \log \left (\frac {{\left | -\cos \left (d x + c\right ) + 1 \right |}}{{\left | \cos \left (d x + c\right ) + 1 \right |}}\right ) + \frac {4 \, b}{\frac {\cos \left (d x + c\right ) - 1}{\cos \left (d x + c\right ) + 1} - 1}}{2 \, d} \]

[In]

integrate(csc(d*x+c)*(a+b*sin(d*x+c)^2),x, algorithm="giac")

[Out]

1/2*(a*log(abs(-cos(d*x + c) + 1)/abs(cos(d*x + c) + 1)) + 4*b/((cos(d*x + c) - 1)/(cos(d*x + c) + 1) - 1))/d

Mupad [B] (verification not implemented)

Time = 12.97 (sec) , antiderivative size = 23, normalized size of antiderivative = 0.88 \[ \int \csc (c+d x) \left (a+b \sin ^2(c+d x)\right ) \, dx=-\frac {b\,\cos \left (c+d\,x\right )+a\,\mathrm {atanh}\left (\cos \left (c+d\,x\right )\right )}{d} \]

[In]

int((a + b*sin(c + d*x)^2)/sin(c + d*x),x)

[Out]

-(b*cos(c + d*x) + a*atanh(cos(c + d*x)))/d